import time
def bubble_sort(nums):
  swapped = True
  a=time.time()
  while swapped:
    swapped = False
    for i in range(len(nums) - 1):
      if nums[i] > nums[i + 1]:
         nums[i], nums[i + 1] = nums[i + 1], nums[i]
  b = time.time()
  return round(((b-a)*1000))
def read2list(filename):
  file = open(filename, 'r')
  data = file.readlines()
  return data
m1 = read2list("m1_sorted.txt")
m2 = read2list("m2_reverse.txt")
m3 = read2list("m3_shuffle.txt")




print('m1_sorted.txt',bubble_sort(m1),'millisecond')
print('m2_sorted.txt',bubble_sort(m2),'millisecond')
print('m2_sorted.txt',bubble_sort(m2),'millisecond')


